# -*- coding: UTF-8 -*-

import wx

APP_TITLE           = "UsableOutliner 0.01a"

ID_IMPORT           = wx.NewId()
ID_EXPORT           = wx.NewId()

ID_ADD_SIBLING      = wx.NewId()
ID_ADD_CHILD        = wx.NewId()
ID_PROMOTE          = wx.NewId()
ID_DEMOTE           = wx.NewId()
ID_MOVEUP           = wx.NewId()
ID_MOVEDOWN         = wx.NewId()

ID_SAVEALL          = wx.NewId()
ID_CLOSEALL         = wx.NewId()
ID_PREVIOUS_OUTLINE = wx.NewId()
ID_NEXT_OUTLINE     = wx.NewId()


class MainWindow(wx.Frame):

    def __init__(self):
        wx.Frame.__init__(self, None, -1, APP_TITLE, size=(640, 480))
        self.__initMenuBar()
        self.CreateStatusBar()
        self.Show()

    def __initMenuBar(self):
        menuFile = wx.Menu()
        menuFile.Append(wx.ID_NEW)
        menuFile.Append(wx.ID_OPEN)
        menuFile.Append(ID_IMPORT, "&Import...", "Import an outline")
        menuFile.AppendSeparator()
        menuFile.Append(wx.ID_SAVE)
        menuFile.Append(wx.ID_SAVEAS)
        menuFile.Append(ID_EXPORT, "&Export...", "Export current outline to a different file format")
        menuFile.AppendSeparator()
        menuFile.Append(wx.ID_PREVIEW)
        menuFile.Append(wx.ID_PRINT)
        menuFile.AppendSeparator()
        menuFile.Append(wx.ID_CLOSE)
        menuFile.Append(wx.ID_EXIT)
        self.Bind(wx.EVT_MENU, self.OnQuit, id=wx.ID_EXIT)

        menuFile.Enable(wx.ID_SAVE, False)
        menuFile.Enable(wx.ID_SAVEAS, False)
        menuFile.Enable(ID_EXPORT, False)
        menuFile.Enable(wx.ID_PREVIEW, False)
        menuFile.Enable(wx.ID_PRINT, False)
        menuFile.Enable(wx.ID_CLOSE, False)

        menuEdit = wx.Menu()
        menuEdit.Append(wx.ID_UNDO)
        menuEdit.Append(wx.ID_REDO)
        menuEdit.AppendSeparator()
        menuEdit.Append(wx.ID_CUT)
        menuEdit.Append(wx.ID_COPY)
        menuEdit.Append(wx.ID_PASTE)
        menuEdit.AppendSeparator()
        menuEdit.Append(wx.ID_PREFERENCES)

        menuEdit.Enable(wx.ID_UNDO, False)
        menuEdit.Enable(wx.ID_REDO, False)
        menuEdit.Enable(wx.ID_CUT, False)
        menuEdit.Enable(wx.ID_COPY, False)
        menuEdit.Enable(wx.ID_PASTE, False)

        menuNodes = wx.Menu()
        menuNodes.Append(ID_ADD_SIBLING, "Add &Sibling Node", "Add a sibling node to the current node")
        menuNodes.Append(ID_ADD_CHILD, "Add &Child Node", "Add a child node to the current node")
        menuNodes.AppendSeparator()
        menuNodes.Append(ID_PROMOTE, "&Promote One Level", "Promote this node (and its children) in the hierarchy")
        menuNodes.Append(ID_DEMOTE, "D&emote One Level", "Demote this node (and its children) in the hierarchy")
        menuNodes.AppendSeparator()
        menuNodes.Append(ID_MOVEUP, "Move &Up", "Move this node (and its children) up")
        menuNodes.Append(ID_MOVEDOWN, "Move D&own", "Move this node (and its children) down")
        menuNodes.AppendSeparator()
        menuNodes.Append(wx.ID_DELETE, "", "Delete this node")
        menuNodes.AppendSeparator()
        menuNodes.Append(wx.ID_FIND)
        
        menuNodes.Enable(ID_ADD_SIBLING, False)
        menuNodes.Enable(ID_ADD_CHILD, False)
        menuNodes.Enable(ID_PROMOTE, False)
        menuNodes.Enable(ID_DEMOTE, False)
        menuNodes.Enable(ID_MOVEUP, False)
        menuNodes.Enable(ID_MOVEDOWN, False)
        menuNodes.Enable(wx.ID_DELETE, False)
        menuNodes.Enable(wx.ID_FIND, False)

        menuOutlines = wx.Menu()
        menuOutlines.Append(ID_SAVEALL, "&Save All", "Save all outlines")
        menuOutlines.Append(ID_CLOSEALL, "&Close All", "Save all outlines")
        menuOutlines.AppendSeparator()
        menuOutlines.Append(ID_PREVIOUS_OUTLINE, "&Previous Outline", "Previous Outline")
        menuOutlines.Append(ID_NEXT_OUTLINE, "&Next Outline", "Next Outline")

        menuOutlines.Enable(ID_SAVEALL, False)
        menuOutlines.Enable(ID_CLOSEALL, False)
        menuOutlines.Enable(ID_PREVIOUS_OUTLINE, False)
        menuOutlines.Enable(ID_NEXT_OUTLINE, False)

        menuHelp = wx.Menu()
        menuHelp.Append(wx.ID_ABOUT, "", "About UsableOutliner")

        menuBar = wx.MenuBar()
        menuBar.Append(menuFile, "&File")
        menuBar.Append(menuEdit, "&Edit")
        menuBar.Append(menuNodes, "&Nodes")
        menuBar.Append(menuOutlines, "&Outlines")
        menuBar.Append(menuHelp, "&Help")
        self.SetMenuBar(menuBar)

    def OnQuit(self, evt):
        self.Close()


class AboutDialog(wx.Frame):

    def __init__(self):
        pass

